<div style="padding:10px;">
<form id="dept_f" method="post">
    <table cellpadding="5">
        <tr>
            <td>名称:</td>
            <td><input class="easyui-textbox" type="text" name="dept_name" data-options="required:true" style="width:200px;"></input></td>
        </tr>       
        <tr>
            <td>父部门:</td>
            <td><input class="easyui-combobox" id="dept_parent_id" name="parent_id" data-options="required:true" style="width:200px;"></td>
        </tr>        
        <tr>
            <td>排序：</td>
            <td><input class="easyui-numberbox" name="dept_sort" data-options="min:1,max:100,required:true" missingMessage="输入排序号，1-100以内" style="width:200px;"></td>
        </tr>
         <tr>
            <td>图标：</td>
            <td><input class="easyui-textbox" name="dept_iconCls" style="width:200px;"></td>
        </tr>
    </table>
	<input type="hidden" name="dept_id">
    <input type="hidden" name="priv_id">
</form>
</div>
<div id="dept_edit_sub" style="padding:20px; border-top:1px solid #CCC; display:none;">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveDept()">保存</a>
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="delDept()">删除</a>
</div>
<div id="dept_new_sub" style="padding:20px; border-top:1px solid #CCC; display:block;">
	<a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="saveDept()">新建</a>
</div>
<script>
function dept_s_tree(pid){
	$('#dept_parent_id').combotree({
		url: '<?php echo base_url('systemmanage/dept_data?_=')?>'+GetRandomNum(),
		method:'post',
		required: true,
		panelHeight: 400
	});
	if(pid){
		$('#dept_parent_id').combotree('setValue', pid);
	}
}
dept_s_tree();
function dept_f_loadLocal(m){//填充表单数据
	$('#dept_f').form('load',{
		dept_id:'<?php echo @$deptinfo[0]['id'];?>',
		dept_name:'<?php echo @$deptinfo[0]['text'];?>',
		parent_id:'<?php echo $deptinfo[0]['parentId']?>',
		dept_sort:'<?php echo @$deptinfo[0]['dept_sort'];?>',
		dept_iconCls:'<?php echo @$deptinfo[0]['dept_iconCls'];?>'
	});
	if(m == 'edit'){
		$("#dept_edit_sub").show();
		$("#dept_new_sub").hide();
	}else{
		$("#dept_edit_sub").hide();
		$("#dept_new_sub").show();
	}
}
</script>
